package com.cloudcc.mobile.dao.impl;

import java.net.URLEncoder;

import com.cloudcc.mobile.AppContext;
import com.cloudcc.mobile.dao.ChatUserDao;
import com.cloudcc.mobile.util.NetWork;
import com.cloudcc.mobile.util.UrlTools;

public class ChatUserDaoImpl implements ChatUserDao {

	/**
	 * 获取信息
	 */
	@Override
	public String getUserInfo(String data) throws Exception {
		String result = "";
		String Data = URLEncoder.encode(data, "utf-8");// 这个是对json数据转编码，必须的
		String url = UrlTools.url + UrlTools.url_path
				+ "serviceName=getChatterUserInfo&data=" + Data + "&binding="
				+ AppContext.binding;
		result = NetWork.get(url.trim());
		return result;
	}

	/**
	 * 修改用户信息
	 */
	@Override
	public String updateUserInfo(String data) throws Exception {
		String result = "";
		String Data = URLEncoder.encode(data, "utf-8");// 这个是对json数据转编码，必须的
		String url = UrlTools.url + UrlTools.url_path
				+ "serviceName=updateChatterUserInfo&data=" + Data
				+ "&binding=" + AppContext.binding;
		result = NetWork.get(url.trim());
		return result;
	}

	@Override
	public String getMEUserInfo(String userId) throws Exception {
		String result = "";
		String data = "{'userId':'" + userId + "'}";
		String Data = URLEncoder.encode(data, "utf-8");// 这个是对json数据转编码，必须的
		String url = UrlTools.url + UrlTools.url_path
				+ "serviceName=getChatterUserInfo&data=" + Data + "&binding="
				+ AppContext.binding;
		result = NetWork.get(url.trim());
		return result;
	}

}
